import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GuidanceVO, GuidanceForm, GuidanceQuery } from '@/api/stroke/guidance/types';

/**
 * 查询健康指导视频列表
 * @param query
 * @returns {*}
 */

export const listGuidance = (query?: GuidanceQuery): AxiosPromise<GuidanceVO[]> => {
  return request({
    url: '/stroke/guidance/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询健康指导视频详细
 * @param id
 */
export const getGuidance = (id: string | number): AxiosPromise<GuidanceVO> => {
  return request({
    url: '/stroke/guidance/' + id,
    method: 'get'
  });
};

/**
 * 新增健康指导视频
 * @param data
 */
export const addGuidance = (data: GuidanceForm) => {
  return request({
    url: '/stroke/guidance',
    method: 'post',
    data: data
  });
};

/**
 * 修改健康指导视频
 * @param data
 */
export const updateGuidance = (data: GuidanceForm) => {
  return request({
    url: '/stroke/guidance',
    method: 'put',
    data: data
  });
};

/**
 * 删除健康指导视频
 * @param id
 */
export const delGuidance = (id: string | number | Array<string | number>) => {
  return request({
    url: '/stroke/guidance/' + id,
    method: 'delete'
  });
};
